
# 定义了一个学生类：属性:学号，姓名，年龄，性别，身高，体重，成绩，家庭地址，电话号码。行为：学习（要求参数传入学习的时间）
# 玩游戏（要求参数传入游戏名），编程（要求参数传入写代码的行数），数的求和（要求参数用变长参数来做，返回求和结果）

class Student:       #学生类
    def __init__(self,id, name, age, gender, height, weight, score, address, number):
        self.id = id
        self.name = name
        self.age = age
        self.gender = gender
        self.height = height
        self.weight = weight
        self.score = score
        self.address = address
        self.number = number

    def study(self, study_time):
        self.study_time = study_time
        return f"{self.name}学习了{study_time}小时"

    def play(self, game_name):
        self.game_name = game_name
        return f"{self.name}在玩{game_name}游戏"

    def programming(self, line_number):
        self.line_number = line_number
        return f"{self.name}敲了{line_number}行代码"

    def num_sum(*args):
        return sum(args)

# 车类：属性：车型号，车轮数，车身颜色，车重量，油箱存储大小 。功能：跑（要求参数传入车的具体功能，比如越野，赛车）
# 创建：法拉利，宝马，铃木，五菱，拖拉机对象


class Vehicle:       #汽车类
    def __init__(self, model, wheels, color, weight, tank_capacity ):
        self.model = model
        self.wheels = wheels
        self.color = color
        self.weight = weight
        self.tank_capacity = tank_capacity

    def run(self, function_type : str):
        if function_type == "越野":
            return f"{self.model}正在崎岖地形越野"
        elif function_type == "赛车":
            return f"{self.model}以赛道模式疾驰"
        elif function_type == "运输":
            return f"{self.model}开启载货模式"
        elif function_type == "农耕":
            return f"{self.model}切换低速档位"
        else:
            return f"{self.model}未知功能"

# # 创建车辆实例
# ferrari = Vehicle("法拉利F8", 4, "红色", 1.4, 78)
# bmw = Vehicle("宝马X5", 4, "白色", 2.1, 85)
# suzuki = Vehicle("铃木吉姆尼", 4, "黄色", 1.1, 40)
# wuling = Vehicle("五菱宏光", 4, "银色", 1.3, 45)
# tractor = Vehicle("东方红拖拉机", 6, "绿色", 3.8, 120)
#
# print(ferrari.run('赛车'))
# print(tractor.run('瞎写的'))




# 笔记本类：属性：型号，待机时间，颜色，重量，cpu型号，内存大小，硬盘大小。  行为：打游戏（传入游戏的名称）,办公。

class Computer:         #电脑类
    def __init__(self, model, standby_time, color, weight, cpu_model, memory_size,disk_capacity ):
        self.model = model
        self.standby_time = standby_time
        self.color = color
        self.cpu_model = cpu_model
        self.memory_size = memory_size
        self.disk_capacity = disk_capacity

    def play_game(self, game_name):
        self.game_name = game_name
        return f"用{self.model}正在打{self.game_name}"

    def official_business(self):
        self.official_business()
        return f"用{self.model}正在办公"

# 猴子类：属性：类别，性别，身体颜色，体重。行为：造火（要求传入造火的材料：比如木棍还是石头）
# 学习事物（要求参数传入学习的具体事物，可以不止学习一种事物）

class Monkey:      # 猴子类
    def __init__(self, category, gender, body_color, weight):
        self.category = category
        self.gender = gender
        self.body_color = body_color
        self.weight = weight

    def light_fire(self, *materials):
        self.materials = materials
        return f"{self.category}使用{'、' .join(self.materials)}生火"

# monkey01 = Monkey("金丝猴","雄性","黄色","25kg")
# print(monkey01.light_fire("干草","树枝"))




